package lab03;

import java.io.*;

public class Test04 {
    public static void main(String[] args) {

        try {
            FileInputStream file=new FileInputStream("E:\\test.txt");
            InputStreamReader reader=new InputStreamReader(file);
            BufferedReader buffer=new BufferedReader(reader);

            File fl=new File("E:\\test1.txt");
            fl.createNewFile();

            FileOutputStream fo=new FileOutputStream("E:\\test1.txt");
            OutputStreamWriter osw=new OutputStreamWriter(fo);
            BufferedWriter bw=new BufferedWriter(osw);

            String line=buffer.readLine();
            while(line!=null)
            {
                System.out.println(line);
                bw.write(line);
                bw.newLine();
                bw.flush();
                line=buffer.readLine();
            }
        }
        catch (Exception e) {
            e.printStackTrace();
        }

    }
}
